﻿package com.pool.ui 
{
	import flash.display.Sprite;
	import flash.text.TextField;
	
	/**
	 * ...
	 * @author Scott
	 */
	public class TextWin extends Sprite
	{
		private var _showText:TextField;
		private var _info:Array;
		private var _VScrollBar:ScrollBar;
		private var _HScrollBar:ScrollBar;
		
		private var _w:Number;
		private var _h:Number;
		
		public function TextWin(w:Number,h:Number,bgColor:uint,borderColor:uint) 
		{
			_w = w;
			_h = h;
			this.graphics.beginFill(bgColor);
			this.graphics.drawRect(0, 0, w, h);
			this.graphics.endFill();
			
			this.graphics.beginFill(borderColor);
			this.graphics.drawRect(0, 0, w, h);
			this.graphics.drawRect(1, 1, w - 2, h - 2);
			this.graphics.endFill();
			
			_info = [];
			_showText = new TextField();			
			_showText.x = _showText.y = 5;
			_showText.width = w - 10;
			_showText.height = h - 10;
			_showText.multiline = true;
			_showText.wordWrap = true;
			
			this.addChild(_showText);
			
		}
		public function init():void 
		{
			
		}
		
		public function add(str:String):void 
		{
			_showText.appendText(str);
			_info.push(str);
		}
	}

}